package com.veo.controller;

import com.veo.bean.User;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
public class HelloController {

//    @RequestMapping("/1.jpg")
//    public String hello(){
//        return "hello";
//    }

    @RequestMapping("/user/{user}/{emp}")
    public Map matrixVariable(
            @PathVariable("user")String uid,
            @PathVariable("emp")String empid,
            @MatrixVariable(value = "age",pathVar = "user")Integer userAge,
                              @MatrixVariable(value = "age", pathVar = "emp")Integer empAge){
        Map<String, Integer> map = new HashMap<>();
        map.put("userAge",userAge);
        map.put("empAge",empAge);
        map.put("uid",Integer.parseInt(uid));
        map.put("empid",Integer.parseInt(empid));
        return  map;
    }

    @PostMapping("/convertUser")
    public Map convertStringToUser(User user){
        HashMap<String, Object> map = new HashMap<>();
        map.put("user",user);
        return map;
    }

    @ResponseBody
    @GetMapping("/contentNegotiation")
    public User contentNegotiation(){
        User user = new User("李四",12);
        return user;
    }


}

